package com.ruoyi.project.xkx.order.controller;


import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.xkx.order.OrderDetailsService;
import com.ruoyi.project.xkx.order.domain.OrderDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author WuYalong
 * @since 2021-05-12
 */
@RestController
@RequestMapping("/order-details")
public class OrderDetailsController {

    @Autowired
    private OrderDetailsService orderDetailsService;

    /**
     * 查询订单详情 和 学生信息
     * @param orderNumber
     * @return
     */
    @GetMapping("/{orderNumber}")
    public AjaxResult getOrderDetailsByOrderNumber(@PathVariable String orderNumber){
        OrderDetails orderDetail = orderDetailsService.getOrderDetailsByOrderNumber(orderNumber);
        List<OrderDetails> orderDetails = Arrays.asList(orderDetail);
        return AjaxResult.success(orderDetails);
    }
}
